import{
    msg,confirm
}from '../common/layer';
const removeBtnHandler = () => {
  let selectedList = $('#table').bootstrapTable('getSelections');
  if (selectedList.length === 0) {
    msg('请先选择');
    return;
  }


  let removeid = selectedList[0].cat_id;

  confirm(`确定删除这条记录？`, '删除', function () {
    $.post(GLOBAL_RemoveUrl, {
      cat_id: removeid
    }, function (res) {
      if (res.rel == 1) {
        msg(res.msg, () => {
            layer.closeAll();
            let options = $('#table').bootstrapTable('getOptions');
            $('#table').bootstrapTable('destroy');
            $('#table').bootstrapTable(options);
        });
      } else {
        msg(res.msg);
      }
    }, 'json');
  });

};
export {
  removeBtnHandler
}